﻿using UnityEngine;
using System.Collections;

public class TelaFim : MonoBehaviour {

	int id;
	
	void Start () 
	{		
		if(Player.MoreuAs <= 20)
		{
			id = 85;
		}
		else if(Player.MoreuAs > 21 && Player.MoreuAs < 49)
		{
			id = 86;
		}
		else if(Player.MoreuAs > 50)
		{
			id = 87;	
		}
		
/*		if(_Player.Morri == true)
		{
			SetId(7);
		}
*/		
		this.gameObject.AddComponent("MeshRenderer");
		this.gameObject.AddComponent("MeshFilter");

		Mesh mesh = Quad.Create(8.0f, 6.75f);
		this.gameObject.transform.position = new Vector3(0,1,0);
		
		this.gameObject.GetComponent<MeshFilter>().mesh = mesh;
		this.gameObject.GetComponent<MeshRenderer>().material = AtlasManager.globalMaterial;
		
		this.gameObject.GetComponent<MeshFilter>().mesh.uv = new Vector2[]
		{
			new Vector2(AtlasManager.rects[id].xMin, AtlasManager.rects[id].yMax),
			new Vector2(AtlasManager.rects[id].xMax, AtlasManager.rects[id].yMax),
			new Vector2(AtlasManager.rects[id].xMax, AtlasManager.rects[id].yMin),
			new Vector2(AtlasManager.rects[id].xMin, AtlasManager.rects[id].yMin)
		};
	}
	
	void Update () 
	{
	
	}
	
/*	public void SetId(int idn)
    {
        this.id = idn;
    }
    public int GetId()
    {
        return this.id;
    }*/

}
